<?php
my_component_load('testing' , false);
my_component_load('paging' , false);
my_component_load('data_setting', false);
my_component_load('jabatan_specification'); 
 
$task = isset($_GET['task']) ? $_GET['task'] : ""; 
$id= isset( $_GET['id'] ) ? $_GET['id']:  0;
$jabatan_id = isset( $_GET['jabatan_id'] ) ? $_GET['jabatan_id']:  0;
$jenis_id = isset( $_GET['jenis_id'] ) ? $_GET['jenis_id']:  0;
$facebox=false ; 
$modulname = "Admin _BN_ Konfigurasi Data _BN_ Job Specification" ;
if($_SERVER['REQUEST_METHOD'] == "POST" ):
	switch($task){ 
		case   "level_pendidikan_page" :
			$validatepost = form_level_pendidikan_validate($jabatan_id,$id);
			if($validatepost){
				$content = message_multi_error($validatepost);
				$content .= form_level_pendidikan_create($jabatan_id,$id);
				$pagename = "Specification";
				generate_my_web($content,"","plain.php");
				exit;
			}else{
				form_level_pendidikan_submit($jabatan_id,$id);
				$content =  "Updated";
				generate_my_web($content,"","plain.php");
				exit;
			}
			my_direct('index.php?com=jabatan_specification&task=list_specification&jabatan_id='.$jabatan_id);			
			break;	
		case   "golongan_jabatan_page" :
			$validatepost = form_golongan_jabatan_validate($jabatan_id,$id);
			if($validatepost){
				$content = message_multi_error($validatepost);
				$content .= form_golongan_jabatan_create($jabatan_id,$id);
				$pagename = "Specification";
				generate_my_web($content,"","plain.php");		
				exit;
			}else{
				form_golongan_jabatan_submit($jabatan_id,$id);
				$content =  "Updated";
				generate_my_web($content,"","plain.php");
				exit;
			}
			my_direct('index.php?com=jabatan_specification&task=list_specification&jabatan_id='.$jabatan_id);			
			break;				
		case   "kompetensi_page" :
			$validatepost = form_kompetensi_validate($jabatan_id,$id);
			if($validatepost){
				$content = message_multi_error($validatepost);
				$content .= form_kompetensi_create($jabatan_id , $id , $jenis_id);
				$pagename = "Kompetensi";
				generate_my_web($content,"","plain.php");
				exit;
			}else{
				form_kompetensi_submit($jabatan_id,$id);
				$content =  "Updated";
				generate_my_web($content,"","plain.php");
				exit;
			}	
			my_direct('index.php?com=jabatan_specification&task=list_kompetensi&jabatan_id='.$jabatan_id);			
			break;		
		case   "physical_page" :
			$validatepost = form_physical_validate($jabatan_id, $id);
			if($validatepost){
				$content = message_multi_error($validatepost);
				$content .= form_physical_create($jabatan_id,$id);
				$pagename = "Physical Ability";
				generate_my_web($content,"","plain.php");
				exit;
			}else{
				form_physical_submit($jabatan_id,$id);
				$content =  "Updated";
				generate_my_web($content,"","plain.php");
				exit;
			}	
			my_direct('index.php?com=jabatan_specification&task=list_physical&jabatan_id='.$jabatan_id);
			break;				
	}	
else:
	if($task =='list_specification'){	
		$pagename = $modulname." _BN_ Spesification";
		load_facebox_script();
		$view =  list_specification($jabatan_id); 
		generate_my_web($view, $pagename );	
		
	}elseif($task =='level_pendidikan'){	
		$_SESSION['tab_page'] = '#tab0';
		$pagename= "Spesifikasi level pendidikan";
		facebox_page('index.php?com=jabatan_specification&task=level_pendidikan_page&jabatan_id='.$jabatan_id.'&id='.$id  , $pagename , 280	); 
	}elseif($task == 'level_pendidikan_page'){
		$content  = form_level_pendidikan_create($jabatan_id , $id);
		generate_my_web($content,"","plain.php");
		exit; 			
	}elseif($task =='level_pendidikan_delete'){
		$_SESSION['tab_page'] = '#tab0';
		  delete_level_pendidikan($id); 
		 my_direct($_SERVER['HTTP_REFERER']);	

	}elseif($task =='golongan_jabatan'){	
		$_SESSION['tab_page'] = '#tab1';
		$title=  "Spesifikasi golongan jabatan";
		facebox_page('index.php?com=jabatan_specification&task=golongan_jabatan_page&jabatan_id='.$jabatan_id.'&id='.$id  , $title , 280	); 
	}elseif($task == 'golongan_jabatan_page'){
		$content  = form_golongan_jabatan_create($jabatan_id , $id);
		generate_my_web($content,"","plain.php");
		exit; 			
	}elseif($task =='golongan_jabatan_delete'){
		
		$_SESSION['tab_page'] = '#tab1';
		 delete_golongan_jabatan($id);
		 my_direct($_SERVER['HTTP_REFERER']);			 
	}elseif($task =='list_kompetensi'){	
		$pagename = $modulname." _BN_ Kompetensi";
		load_facebox_script();
		$view =  list_kompetensi($jabatan_id); 
		generate_my_web($view, $pagename );	
	}elseif($task =='edit_kompetensi'){
		$_SESSION['tab_page'] = '#tab'.( $jenis_id -1);
		$pagename= "Kompetensi";
		facebox_page('index.php?com=jabatan_specification&task=kompetensi_page&jenis_id='.$jenis_id.'&jabatan_id='.$jabatan_id.'&id='.$id  , $title , 340	); 
	}elseif($task == 'kompetensi_page'){
		$content  = form_kompetensi_create($jabatan_id , $id , $jenis_id);
		generate_my_web($content,"","plain.php");
		exit; 	
	}elseif($task == "kompetensi_delete"){ 
		$_SESSION['tab_page'] = '#tab'.$jenis_id;
		delete_kompetensi($id);
		my_direct($_SERVER['HTTP_REFERER']);
	}elseif($task == "edit_popup_kompetensi"){
		$_SESSION['tab_page'] = '#tab'.$jenis_id;
		$title=  "Edit kompetensi untuk jabatan" ;
		facebox_page('index.php?com=jabatan&task=edit_popup_kompetensi_page&jenis_id='.$jenis_id.'&jabatan_id='.$jabatan_id.'&id='.$id  , $title , 280	); 
	}elseif($task == "edit_popup_kompetensi_page"){
		$pagename = "Hasil input jabatan";
		$view =kompetensi_jabatan_input($jabatan_id , $id , $jenis_id); 
		generate_my_web($view, "Data Jabatan","plain.php" );
		exit; 

	}elseif($task =='list_physical'){	
		$pagename = $modulname." _BN_ Physical Ability";
		load_facebox_script();
		$view =  list_physical($jabatan_id); 
		generate_my_web($view, $pagename );	
	}elseif($task == "physical_page"){ 
		$content  = form_physical_create($jabatan_id,$id);
		generate_my_web($content,"","plain.php");
		exit;
	}elseif($task == "physical_create"){ 
		$title= ($id > '0' ) ?  "Perubahan Data" : "Tambah Data";
		facebox_page('index.php?com=jabatan_specification&task=physical_page&jabatan_id='.$jabatan_id.'&id='.$id , $title , 200	);
	}elseif($task =='physical_delete'){
		 delete_physical($id);
		 my_direct($_SERVER['HTTP_REFERER']);	
		 
	}else{ 
		$pagename = "Job Specification";
		load_facebox_script();	
		$view =  list_jabatan_specification();
		$content = spliter_browser( $view , $pagename ,$href);
		generate_my_web($content, $modulname );
	}
endif;  

?>